package com.dao.student.imp;

import java.util.List;

import javax.annotation.Resource;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

import com.dao.student.StestDao;
import com.po.Student;

@Repository
public class StestDaoImp implements StestDao {

	@Resource(name="sqlSessionTemplate")
	private SqlSessionTemplate sqlSessionTemplate;
	public SqlSessionTemplate getSqlSessionTemplate() {
		return sqlSessionTemplate;
	}

	public void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate) {
		this.sqlSessionTemplate = sqlSessionTemplate;
	}

	@Override
	public Student findStuInfo(Student stu) {
		
		Student student = sqlSessionTemplate.selectOne("findStuInfo",stu);
		return student;
	}

	@Override
	public int addStudent(Student stu) {
		// TODO Auto-generated method stub
		int result = sqlSessionTemplate.insert("addStudent", stu);
		return result;
	}
	
	@Override
	public List<Student> getStuList() {
		// TODO Auto-generated method stub
		List<Student> list = sqlSessionTemplate.selectList("getStuList");
		return list;
	}

	@Override
	public int delStudent(String stuid) {
		// TODO Auto-generated method stub
		int result = sqlSessionTemplate.delete("delStudent", stuid);
		return result;
	}

	@Override
	public int updateStudent(Student stu) {
		// TODO Auto-generated method stub
		int result = sqlSessionTemplate.update("updateStuden", stu);
		return result;
	}

	

}
